package com.buka.communicate.adapter;

import android.app.Activity;
import android.support.v7.widget.RecyclerView;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.buka.communicate.R;
import com.buka.communicate.entity.User;
import com.facebook.drawee.view.SimpleDraweeView;

import net.neiquan.applibrary.base.MyBaseAdapter;
import net.neiquan.applibrary.utils.ImageUtil;
import net.neiquan.applibrary.utils.PixelUtil;

import java.util.List;

import butterknife.ButterKnife;
import butterknife.InjectView;

/**
 * 作者 ： dyj
 * 时间 ： 2016/12/29.
 */

public class PraiseHeadAdapter extends MyBaseAdapter<User, PraiseHeadAdapter.ViewHolder> {


    public PraiseHeadAdapter(Activity context, List data) {
        super(context, data);
    }

    @Override
    public int getItemCount() {
        return 10;
    }

    @Override
    protected ViewHolder getViewHolder() {
        return new ViewHolder(mInflater.inflate(R.layout.item_praise_detail, null));
    }

    @Override
    protected void onBindViewHolder_(final ViewHolder holder, int position) {
        FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        params.width = (PixelUtil.getScreenWidth(context) - PixelUtil.dp2px(context, 70))/8;
        params.height = params.width;
        params.topMargin=params.leftMargin= PixelUtil.dp2px(context, 5);
        holder.mHeadImg.setLayoutParams(params);
        holder.mHeadImg.setImageURI("http://img2.imgtn.bdimg.com/it/u=266057472,3867980612&fm=27&gp=0.jpg");
    }


    static class ViewHolder extends RecyclerView.ViewHolder {
        @InjectView(R.id.mHeadImg)
        SimpleDraweeView mHeadImg;

        ViewHolder(View view) {
            super(view);
            ButterKnife.inject(this, view);
        }
    }
}
